/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.wechat.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.boxin.ims.modules.momarketing.entity.QRCode;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 微信会员Entity
 * @author Jakemanse
 * @version 2013-09-08
 */
@Entity
@Table(name = "wp_wechat_member")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class WechatMember extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	
	
	
	
	public final static String SUBSCRIBE = "1";
	
	
	
	
	private Long id; 				// 编号
	private User user; 				// 用户
	private String wechatId;		//微信ID
	private String name; 			// 名称
	private String birthday;		//生日
	private String sex;				//保密   男  女
	private String mobile;			//手机号
	private Integer score ;			//积分（以厘单位）需除以1000
	private Integer activeScore;	//活动积分（以厘单位）需除以1000
	private Integer	consumeScore;	//消费积分（以厘单位）。。
	private	Integer	creditScore;	//可用信用积分（以厘单位）
	private	Integer unusable;		//不可用信用积分（以厘为单位）
	private Integer money;			//充值余额
	private String lastSignTime;	//上次签到时间(日期格式：20130831)
	private Date createTime;		// 创建日期
	private String password;		//密码
	private String payPassword;		//消费支付密码
	private Date updateTime;		//更新时间
	private String delFlag;			//删除标记（0：正常；1：删除）
	private String number;			//会员号
	private String recommendCode;	//推荐码  唯一
	private String parentCode;       //父推荐码
	private Boolean isRandomPassword;	//是否重新获取了随机密码
	private String remarks; 		// 备注
	private String isAdmin;//是否是会员      0  是会员         1  是管理员
	private Integer	exp;	//会员经验
	private QRCode qrCode;	//对应的二维码
	private String sceneId ;		//渠道二维码  
	private String sceneContent;		//渠道二维码内容
	private String sceneTicket;		//渠道二维码Ticket
	

	private Integer signupCount;//记录签到次数
	private String IDCardNumber;	//身份证号
	private String email;	//邮箱
	
	
	
	private String recommendPic;	//推广图片
	private Date recommendEndTime;	//推广载止时间
	private Long recommendSceneId;	//推广临时渠道二维码ID
	private String recommendPicBg;	//海报背景
	private Integer recommendScore;	//推广活动积分
	
	
	
	//玖久永久码（用于添加门店传图设计师）
	private String jiuSceneId ;		//渠道二维码  
	private String jiuSceneContent;		//渠道二维码内容
	private String jiuSceneTicket;		//渠道二维码Ticket  (添加传图设计师)
	
	
	private String jiuFinanceSceneId ;		//渠道二维码（添加财务 ） 
	private String jiuSceneFinanceTicket;		//渠道二维码Ticket	（添加财务 ）
	
	
	/**
	 * 微信高级接口信息
	 */
	private String nickname;
	private String age;
	private String province;
	private String city;
	private String country;
	private String language;
	private String headimgurl;
	private String subscribeTime;
	
	@Transient
	private String subscribe;//   0没有关注     1关注了
	 
	@Transient
	private Date startTime;
	
	@Transient
	private Date endTime;
	private List<WechatMember> sonWechatMemberList = new ArrayList<WechatMember>();
	private String userName; //显示商家名称
	
	@Transient
	private String zhuce;
	

	public WechatMember() {
		this.createTime = new Date();
		this.updateTime = new Date();
		lastSignTime = DateUtils.getTodayString();
		this.delFlag = DEL_FLAG_NORMAL;
	}

	
	public WechatMember(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_wechat_wechatMember")
	//@SequenceGenerator(name = "seq_wechat_wechatMember", sequenceName = "seq_wechat_wechatMember")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255)
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	

	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public String getWechatId() {
		return wechatId;
	}

	public void setWechatId(String wechatId) {
		this.wechatId = wechatId;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Integer getScore() {
		score = (score == null)?0:score;
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getLastSignTime() {
		return lastSignTime;
	}

	public void setLastSignTime(String lastSignTime) {
		this.lastSignTime = lastSignTime;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Transient
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	@Transient
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getSex() {
		sex = (StringUtils.isEmpty(sex)) ? "保密":sex;
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getAge() {
		return age;
	}

	public void setAge(String age) {
		this.age = age;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getHeadimgurl() {
		return headimgurl;
	}

	public void setHeadimgurl(String headimgurl) {
		this.headimgurl = headimgurl;
	}
	
	
	public String getSubscribeTime() {
		return subscribeTime;
	}

	public void setSubscribeTime(String subscribeTime) {
		this.subscribeTime = subscribeTime;
	}


	public Integer getMoney() {
		return money==null ?0:money;
	}


	public void setMoney(Integer money) {
		this.money = money;
	}


	public String getPayPassword() {
		return payPassword;
	}

	public void setPayPassword(String payPassword) {
		this.payPassword = payPassword;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}


	public String getRecommendCode() {
		return recommendCode;
	}


	public void setRecommendCode(String recommendCode) {
		this.recommendCode = recommendCode;
	}


	public String getParentCode() {
		return parentCode;
	}


	public void setParentCode(String parentCode) {
		this.parentCode = parentCode;
	}

	@Transient
	public List<WechatMember> getSonWechatMemberList() {
		return sonWechatMemberList;
	}


	public void setSonWechatMemberList(List<WechatMember> sonWechatMemberList) {
		this.sonWechatMemberList = sonWechatMemberList;
	}


	public Integer getSignupCount() {
		return signupCount==null ?0:signupCount;
	}


	public void setSignupCount(Integer signupCount) {
		this.signupCount = signupCount;
	}

	
	
	public Boolean getIsRandomPassword() {
		return isRandomPassword;
	}


	public void setIsRandomPassword(Boolean isRandomPassword) {
		this.isRandomPassword = isRandomPassword;
	}

	@Transient
	public boolean isRandomPassword(){
		return getIsRandomPassword() != null && getIsRandomPassword() == true;
	}

	@Transient
	public String getUserName() {
		return userName;
	}


	public void setUserName(String userName) {
		this.userName = userName;
	}


	public String getIsAdmin() {
		return isAdmin;
	}


	public void setIsAdmin(String isAdmin) {
		this.isAdmin = isAdmin;
	}

	@ManyToOne
	@JoinColumn(name="qrcode_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public QRCode getQrCode() {
		return qrCode;
	}


	public void setQrCode(QRCode qrCode) {
		this.qrCode = qrCode;
	}


	public Integer getExp() {
		return exp;
	}


	public void setExp(Integer exp) {
		this.exp = exp;
	}


	public Integer getActiveScore() {
		return activeScore;
	}


	public void setActiveScore(Integer activeScore) {
		this.activeScore = activeScore;
	}


	public Integer getConsumeScore() {
		return consumeScore;
	}


	public void setConsumeScore(Integer consumeScore) {
		this.consumeScore = consumeScore;
	}


	public Integer getCreditScore() {
		return creditScore;
	}


	public void setCreditScore(Integer creditScore) {
		this.creditScore = creditScore;
	}


	public Integer getUnusable() {
		return unusable;
	}


	public void setUnusable(Integer unusable) {
		this.unusable = unusable;
	}

	@Transient
	public String getSubscribe() {
		return subscribe;
	}


	public void setSubscribe(String subscribe) {
		this.subscribe = subscribe;
	}


	public String getSceneId() {
		return sceneId;
	}


	public void setSceneId(String sceneId) {
		this.sceneId = sceneId;
	}



	public String getSceneTicket() {
		return sceneTicket;
	}


	public void setSceneTicket(String sceneTicket) {
		this.sceneTicket = sceneTicket;
	}


	public String getSceneContent() {
		return sceneContent;
	}


	public void setSceneContent(String sceneContent) {
		this.sceneContent = sceneContent;
	}


	public String getIDCardNumber() {
		return IDCardNumber;
	}


	public void setIDCardNumber(String iDCardNumber) {
		IDCardNumber = iDCardNumber;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getRecommendPic() {
		return recommendPic;
	}


	public void setRecommendPic(String recommendPic) {
		this.recommendPic = recommendPic;
	}


	public Date getRecommendEndTime() {
		return recommendEndTime;
	}


	public void setRecommendEndTime(Date recommendEndTime) {
		this.recommendEndTime = recommendEndTime;
	}


	public Long getRecommendSceneId() {
		return recommendSceneId;
	}


	public void setRecommendSceneId(Long recommendSceneId) {
		this.recommendSceneId = recommendSceneId;
	}


	public String getRecommendPicBg() {
		return recommendPicBg;
	}


	public void setRecommendPicBg(String recommendPicBg) {
		this.recommendPicBg = recommendPicBg;
	}


	public Integer getRecommendScore() {
		return recommendScore;
	}


	public void setRecommendScore(Integer recommendScore) {
		this.recommendScore = recommendScore;
	}

	@Transient
	public String getZhuce() {
		return zhuce;
	}


	public void setZhuce(String zhuce) {
		this.zhuce = zhuce;
	}


	public String getJiuSceneId() {
		return jiuSceneId;
	}


	public void setJiuSceneId(String jiuSceneId) {
		this.jiuSceneId = jiuSceneId;
	}


	public String getJiuSceneContent() {
		return jiuSceneContent;
	}


	public void setJiuSceneContent(String jiuSceneContent) {
		this.jiuSceneContent = jiuSceneContent;
	}


	public String getJiuSceneTicket() {
		return jiuSceneTicket;
	}


	public void setJiuSceneTicket(String jiuSceneTicket) {
		this.jiuSceneTicket = jiuSceneTicket;
	}


	public String getJiuSceneFinanceTicket() {
		return jiuSceneFinanceTicket;
	}


	public void setJiuSceneFinanceTicket(String jiuSceneFinanceTicket) {
		this.jiuSceneFinanceTicket = jiuSceneFinanceTicket;
	}


	public String getJiuFinanceSceneId() {
		return jiuFinanceSceneId;
	}


	public void setJiuFinanceSceneId(String jiuFinanceSceneId) {
		this.jiuFinanceSceneId = jiuFinanceSceneId;
	}
	
	
}


